<script setup lang="ts">
import { request } from '@/apis'
import { useCounterStore } from '@/stores/counter'
import { useRouter } from 'vue-router'

const store = useCounterStore()
const router = useRouter()

const submit = async () => {
  await request.patch('/v1_0/user/profile', {
    intro: store.jianjie,
  })
  router.back()
}
</script>

<template>
  <van-cell-group inset style="margin-top: 20px">
    <van-field
      v-model="store.jianjie"
      rows="2"
      autosize
      type="textarea"
      maxlength="50"
      placeholder="用一句话介绍自己吧"
      show-word-limit
    />
  </van-cell-group>
  <button @click="submit">提交</button>
</template>
<style scoped>
button {
  width: 70px;
  height: 35px;
  color: #fc6627;
  position: absolute;
  right: 20px;
  margin: 20px;
  background-color: white;
  border-radius: 20px;
  border: none;
}
</style>
